package com.cts.generate;

import java.io.StringWriter;
import java.io.Writer;
import java.util.Properties;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;

import com.cts.util.CommonUtil;
/**
 * 
 * @author loctb 
 * 11:58 pm 09/07/2013
 * Home
 */
public class Main {
	public static void main(String[] args) throws Exception{
		
		//initialize Velocity
		Velocity.init("./src/velocity.properties"); //đọc thông số
		// get the template
		Template template =
				Velocity.getTemplate("src/templates/Main.vm");
		// create a context for Velocity
		VelocityContext context = new VelocityContext();
		// set the who variable
		context.put("PackageName", "Tống Bảo Lộc");
		context.put("ClassName", "Generate");
		// create the output
		Writer writer = new StringWriter();
		template.merge(context, writer);
		// write out
		System.out.println(writer.toString());
		CommonUtil.WriteToFile("generated-src/Generate.java", writer.toString());
	}
}
